Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #15206: Handling keept_output and asynchronous parameters in the remote-run API #2302

Merged
merged 1 commit into from
Jul 16, 2019
Merged

Fixes #15206: Handling keept_output and asynchronous parameters in the remote-run API #2302

merged 1 commit into from
Jul 16, 2019

Conversation

bernsteining
Copy link
Contributor

@@ -65,6 +65,20 @@ impl RemoteRun {
})
}

pub fn reply_keep_output(&self, job_config: Arc<JobConfig>) -> impl warp::reply::Reply
{
if self.run_parameters.keep_output == true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to explicitely compare to true, cargo clippy would likely mention it

@bernsteining
Copy link
Contributor Author

Commit modified

1 similar comment
@bernsteining
Copy link
Contributor Author

Commit modified

@@ -65,32 +65,66 @@ impl RemoteRun {
})
}

pub fn target_to_vector(&self, job_config: Arc<JobConfig>) -> Vec<String> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a method of RemoteRunTarget, called get_connected_nodes or something like this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vector is a technical implementation detail, you should strive to use applicative business names as much as possible to keep things readable

return Err(warp::reject::custom(
"keep_output and asynchronous cannot be true simultaneously",
));
}
if self.target == RemoteRunTarget::All {
info!("conditions OK");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is probably useless, if there is no error we can assume parameters were correct

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

up

@bernsteining
Copy link
Contributor Author

Commit modified

1 similar comment
@bernsteining
Copy link
Contributor Author

Commit modified

Copy link
Member

@amousset amousset left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests/fake_agent.sh is missing from this PR

@@ -221,8 +250,33 @@ impl RunParameters {
.map_err(|e| panic!("error while running child: {}", e));

tokio::spawn(child_future);
//thread::sleep(time::Duration::from_millis(500));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leftover from a test

@@ -47,4 +47,36 @@ mod tests {

assert_eq!(res.unwrap().text().unwrap(), "Unhandled rejection: Invalid agent Condition : Invalid agent Condition : Wrong condition: \'clas~1\', it should match ^[a-zA-Z0-9][a-zA-Z0-9_]*$".to_string());
}

#[test]
fn integration() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you give it a more descriptive name?

@bernsteining
Copy link
Contributor Author

Commit modified

@bernsteining
Copy link
Contributor Author

PR rebased

@@ -0,0 +1 @@
remote run -D class2,class3 -H server.rudder.local
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the result of the test, it should not be included.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Furthermore, temporary files created by tests should go into target/tmp

@@ -0,0 +1 @@
hello moto la
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@bernsteining
Copy link
Contributor Author

Commit modified

1 similar comment
@bernsteining
Copy link
Contributor Author

Commit modified

.form(&params)
.send();

let data = std::fs::read_to_string("./api_test.txt").expect("Unable to read file");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This path needs to be updated

@bernsteining
Copy link
Contributor Author

Commit modified

2 similar comments
@bernsteining
Copy link
Contributor Author

Commit modified

@bernsteining
Copy link
Contributor Author

Commit modified

@bernsteining
Copy link
Contributor Author

Commit modified

@Normation-Quality-Assistant
Copy link
Contributor

OK, merging this PR

@Normation-Quality-Assistant Normation-Quality-Assistant merged commit 7d41993 into Normation:master Jul 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants